{include file="public/header" /}
<style>
    .layim-chat-main {
        height: 500px !important;
    }

    .current {
        color: red !important;
    }
</style>
<body>
<div class="layui-fluid layui-anim-fadein">
    <div class="layui-card">
        <div class="layim-chat-main">
            <ul id="LAY_view">
                {foreach name="list" item="vo"}
                <li>
                    <div class="layim-chat-user">
                        <img src="/static/admin/images/default.png">
                        <cite>{$vo.user.code}<i>{$vo.create_time}</i></cite></div>
                    <div class="layim-chat-text {if $vo.id == $id}current{/if}">{$vo.comment}</div>
                </li>
                {if $vo.images}
                <li>
                    <div class="layim-chat-text" style="margin-top: 2px;">
                        <img src="{$vo.images}">
                    </div>
                </li>
                {/if}
                {if $vo.rcomment}
                <li class="layim-chat-mine">
                    <div class="layim-chat-user">
                        <img src="/static/admin/images/default.png">
                        <cite><i>{:date('Y-m-d H:i:s',$vo.reply_time)}</i>{$vo.admin_name}</cite></div>
                    <div class="layim-chat-text">{$vo.rcomment}</div>
                </li>
                {/if}
                {/foreach}
            </ul>
        </div>

        <div class="layim-chat-footer">
            <div class="layui-unselect layim-chat-tool">
             <span class="layui-icon layim-tool-image" title="上传图片" layim-event="image" onclick="layer.msg('暂未开放')">
                 <!--                 <input type="file" name="file">-->
             </span>
            </div>
            <div class="layim-chat-textarea">
                <textarea id="content"></textarea>
            </div>
            <div class="layim-chat-bottom">
                <div class="layim-chat-send">
                    <span class="layim-send-btn">回复</span>
                </div>
            </div>
        </div>
    </div>
    <p style="color: red">*Tips:标红的为会员本次留言内容</p>
</div>
</body>
{include file="public/footer" /}
<link rel="stylesheet" href="/static/admin/lib/layui/css/layim.css" media="all">
<script>
    $('.layim-chat-main').scrollTop($('.layim-chat-main')[0].scrollHeight);
    $('.layim-chat-send').click(function () {
        var content = $("#content").val();
        if (!content) {
            layer.msg('请填写回复内容');
            return false;
        }
        var load = layer.load();
        $.ajax({
            type: 'POST',
            url: "{:url('save')}",
            data: {id:'{$id}',rcomment:content},
            dataType: "json",
            success: function (data) {
                layer.close(load);
                if(data.code == 1){
                    notify.success(data.msg,1500,function (){
                        location.reload();
                    });
                }else{
                    notify.error(data.msg);
                }
            }
        });
    });
</script>
</html>